
import org.apache.commons.beanutils.PropertyUtils;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List;

@Service
public class SysUserFeedbackServiceImpl implements SysUserFeedbackService  {

    @Resource
    private SysUserFeedbackMapper sysUserFeedbackMapper;

    /**
     * 获取 SysUserFeedback 分页列表
     */
    @Transactional
    public IPage getSysUserFeedbackPagination( PaginationVo paginationVo, SysUserFeedbackQuery sysUserFeedbackQuery ) throws Exception {

        IPage page = new Page( paginationVo.getPageIndex(), paginationVo.getPageSize() );
        LambdaQueryWrapper<SysUserFeedbackEntity> lqs = new LambdaQueryWrapper();
        sysUserFeedbackMapper.selectPage(page, lqs);

        List<SysUserFeedbackEntity> record = page.getRecords();
        if( !ObjectUtil.isNotEmptyList(record)){
            return page;
        }
        return null;
    }


    /**
     * 获取 SysUserFeedback 所有数据
     *
    */
    @Transactional
    public List<SysUserFeedbackEntity> getSysUserFeedbackAllList( SysUserFeedbackQuery sysUserFeedbackQuery ) throws Exception {

        LambdaQueryWrapper<SysUserFeedbackEntity> lqs = new LambdaQueryWrapper();
        List<SysUserFeedbackEntity> list = sysUserFeedbackMapper.selectList(lqs);
        return list;
    }


    /**
     * 获取 SysUserFeedback 详情
    */
    @Transactional
    public SysUserFeedbackEntity getSysUserFeedbackDetail( Long id) throws Exception {

        SysUserFeedbackEntity sysUserFeedback = sysUserFeedbackMapper.selectById(id);
        return sysUserFeedback;
    }


    /**
     * 新增 SysUserFeedback
     * */
    @Transactional
    public void addSysUserFeedback(SysUserFeedbackVo sysUserFeedbackVo) throws Exception {

        SysUserFeedbackEntity sysUserFeedback = new SysUserFeedbackEntity();
        ReflectionCopy.copyProperties( sysUserFeedback, sysUserFeedbackVo );
        sysUserFeedbackMapper.insert(sysUserFeedback);
        return;
    }


    /**
     * 更新 SysUserFeedback
     * */
    @Transactional
    public void updateSysUserFeedback( SysUserFeedbackVo sysUserFeedbackVo) throws Exception {

        if( sysUserFeedbackVo.getId() == null ){
            throw GlobalException.gen(10021, "id不存在");
        }
        SysUserFeedbackEntity sysUserFeedback = new SysUserFeedbackEntity();
        ReflectionCopy.copyProperties( sysUserFeedback, sysUserFeedbackVo );
        sysUserFeedbackMapper.updateById(sysUserFeedback);
        return;
    }

    /**
     * 删除 SysUserFeedback
     * */
    @Transactional
    public void batchRemoveSysUserFeedback( List<Long> ids ) throws Exception {


        if( !ObjectUtil.isNotEmptyList(ids) ){
            throw GlobalException.gen(10011, "要删除的id不存在");
        }
        sysUserFeedbackMapper.deleteBatchIds(ids);
    }

}

      